package com.yuxi.shuzu;

import java.util.Arrays;

public class Demo2 {


    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5,6,7,8,9,10};
        int[] arr2 = new int[3];
        int sum = 0;
        for (int i = 0; i < arr2.length; i++) {
            arr2[i] = arr[(int) ((Math.random() * (arr.length-1+1)) + 0)];
            sum+=arr2[i];
        }
        System.out.println(Arrays.toString(arr2));
        System.out.println("sum = " + sum);
    }
}
